package services;

import domain.entities.Budget;
import domain.entities.BudgetDAO;
import domain.entities.Protocolo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: vgonzalez
 * Date: 14/09/12
 * Time: 17:01
 * To change this template use File | Settings | File Templates.
 */

@Service
public class BudgetService {
    private BudgetDAO budgetDao;

    public BudgetService() {
    }

    @Autowired
    public BudgetService(BudgetDAO budgetDao) {
        this.budgetDao = budgetDao;
    }

    public List<Budget> findByProtocolo(Protocolo protocolo){
        return budgetDao.findByProtocolo(protocolo);
    }

    public Budget findById(Integer budId){
        return budgetDao.findById(budId);
    }

    public Budget findByCompromisopais(Integer countryId){
        return budgetDao.findByCompromisoPais(countryId);
    }

    public void attachDirty(Budget budget){
        budgetDao.attachDirty(budget);
    }

    public void save(Budget budget){
        budgetDao.save(budget);
    }
}
